package chapter1.dataabstraction.example;

/**
 * @author quanlinlin on 2018/11/17 15:26.
 * @version 1.0
 */
public class Date {

    private final int month;

    private final int day;

    private final int year;

    public Date(int month, int day, int year) {
        this.month = month;
        this.day = day;
        this.year = year;
    }

    private int month() {
        return month;
    }

    private int day() {
        return day;
    }

    private int year() {
        return year;
    }

    @Override
    public String toString() {
        return month() + "/" +
                day() + "/" +
                year();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Date date = (Date) o;
        return month == date.month &&
                day == date.day &&
                year == date.year;
    }

}
